package com.wits.qso.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.wits.platform.entity.BaseEntity;

@Entity
@Table(name="qso_croom")
public class Croom extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2876978236994713593L;
	
	/** 教室代码 **/
	private String crmId;
	
	/** 教室名称 **/
	private String crmTitle;
	/** 教室编号 **/
	private String crmCode;
	private String crmAddress = null;
	private int weekT = 0;
	private int weekF = 0;
	private int crmClassNum = 0;
	private Date dateT = null;
	private Date dateF = null;
	
	@Id
	@GenericGenerator(name = "idGen", 
					strategy = "com.wits.platform.common.id.generator.IDGenerator",
					parameters={ 
								@Parameter(name = "segment_value", value = "QSO_CRM_ID"), 
								@Parameter(name="table_name",value="wits_id_generator"),
								@Parameter(name="value_column_name",value="gen_value"),
								@Parameter(name="segment_column_name",value="gen_name"),
								@Parameter(name="segment_value_length",value="10"),
								@Parameter(name="sq_format",value="%08d"), 
								@Parameter(name="sq_prefix",value="CR") 
					})
	@GeneratedValue(generator = "idGen")
	@Column(name = "crm_id", nullable = false, insertable = true, updatable = false, length = 10)
	public String getCrmId() {
		return crmId;
	}


	public void setCrmId(String crmId) {
		this.crmId = crmId;
	}

	@Column(name="crm_title",length=100)
	public String getCrmTitle() {
		return crmTitle;
	}


	public void setCrmTitle(String crmTitle) {
		this.crmTitle = crmTitle;
	}

	@Column(name="crm_code",length=10)
	public String getCrmCode() {
		return crmCode;
	}


	public void setCrmCode(String crmCode) {
		this.crmCode = crmCode;
	}
	
	@Temporal(TemporalType.DATE)
	@Column(name = "crm_date_start")
	public Date getDateT() {
		return dateT;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "crm_date_end")
	public Date getDateF() {
		return dateF;
	}
		
	@Column(name = "crm_address", length = 500)
	public String getCrmAddress() {
		return crmAddress;
	}

	@Column(name = "crm_week_start", length = 2)
	public int getWeekT() {
		return weekT;
	}

	@Column(name = "crm_week_end", length = 2)
	public int getWeekF() {
		return weekF;
	}

	@Column(name = "crm_classnum", length = 2)
	public int getCrmClassNum() {
		return crmClassNum;
	}

	public void setCrmAddress(String crmAddress) {
		this.crmAddress = crmAddress;
	}

	public void setWeekT(int weekT) {
		this.weekT = weekT;
	}

	public void setWeekF(int weekF) {
		this.weekF = weekF;
	}

	public void setCrmClassNum(int crmClassNum) {
		this.crmClassNum = crmClassNum;
	}

	public void setDateT(Date dateT) {
		this.dateT = dateT;
	}

	public void setDateF(Date dateF) {
		this.dateF = dateF;
	}

	@Override
	public String display() {
		// TODO Auto-generated method stub
		return null;
	}
	
	public String toString(){
		return "{\"crmId\":\"" + this.crmId 
				+ "\",\"crmTitle\":\"" + this.crmTitle
				+ "\",\"crmCode\":\"" + this.crmCode 
				+ "\",\"time\": {\"dateF\":\"" + this.dateF
				+ "\",\"dateT\":\"" + this.dateT
				+ "\"}  }";
	}
}
